package com.jml.moreproxy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Types;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private JdbcTemplate jdbcTemplate ;

	/*@Autowired
	private UserService userService;*/


	@Async
	@Transactional
	@Override
	public void save(User user) {
		System.out.println("执行方法");
		jdbcTemplate.update("insert into user (name,age,sex) values (?,?,?)",
				new Object[]{user.getName(),user.getAge(),user.getSex()},
				new int[]{Types.VARCHAR,Types.INTEGER,Types.VARCHAR});
	}


}
